<?php
require '../connect/connect.php';
$page='main_forum';
include_once 'header.php';
 ?>
<div id="content"><div>
<!--        <button style="width: 100%; font-size: 14px; "><a href="create_topic.php" >Ask a question or add new topic</a></button>-->
<a href="create_topic.php" class="btn">Click here  to ask a new question</a>
    <h3>Most Recent Topics/Questions</h3>
<?php

$tbl_name="forum_question";
$sql="SELECT * FROM $tbl_name ORDER BY datetime DESC";
// OREDER BY id DESC is order result by descending 
$result=mysql_query($sql);
?>
<table width="100%">
<!--<tr>
<td width="6%" bgcolor="#E6E6E6"><strong>#</strong></td>
<td><strong>Topic</strong></td>
<td ><strong>Detail </strong></td>
<td ><strong>Replies</strong></td>
<td><strong>Date/Time</strong></td>
</tr>-->

<?php
if (mysql_num_rows($result) > 0) {while ($row = mysql_fetch_assoc($result)) { // Start looping table row 
    extract($row);
//    var_dump($row);
//    exit();
?>
<tr>
<!--<td ><?php echo $row['id']; ?></td>-->
<td ><a href="view_topic.php?id=<?php echo $row['id']; ?>"><?php echo $row['detail']; ?></a><BR></td>
<!--<td ><?php echo $row['detail']. " (".$row['datetime'].")"?></td>-->
</tr>
<!--

</tr>

<?php
}
}
mysql_close();
?>
</table>
<?php include_once 'footer.php'; ?>